package com.dime.basic.service.impl;

import java.util.List;

import com.dime.basic.api.domain.DimeBasedisease;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.uuid.IdUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dime.basic.mapper.DimeBasediseaseMapper;

import com.dime.basic.service.IDimeBasediseaseService;

/**
 * 疾病Service业务层处理
 *
 * @author ruoyi
 * @date 2023-09-28
 */
@Service
public class DimeBasediseaseServiceImpl implements IDimeBasediseaseService
{
    @Autowired
    private DimeBasediseaseMapper dimeBasediseaseMapper;

    /**
     * 查询疾病
     *
     * @param id 疾病主键
     * @return 疾病
     */
    @Override
    public DimeBasedisease selectDimeBasediseaseById(String id)
    {
        return dimeBasediseaseMapper.selectDimeBasediseaseById(id);
    }

    /**
     * 查询疾病列表
     *
     * @param dimeBasedisease 疾病
     * @return 疾病
     */
    @Override
    public List<DimeBasedisease> selectDimeBasediseaseList(DimeBasedisease dimeBasedisease)
    {
        return dimeBasediseaseMapper.selectDimeBasediseaseList(dimeBasedisease);
    }

    /**
     * 新增疾病
     *
     * @param dimeBasedisease 疾病
     * @return 结果
     */
    @Override
    public int insertDimeBasedisease(DimeBasedisease dimeBasedisease)
    {
        dimeBasedisease.setId(IdUtils.fastUUID());
        dimeBasedisease.setCreateTime(DateUtils.getNowDate());
        dimeBasedisease.setCreateBy(SecurityUtils.getUsername());
        return dimeBasediseaseMapper.insertDimeBasedisease(dimeBasedisease);
    }

    /**
     * 修改疾病
     *
     * @param dimeBasedisease 疾病
     * @return 结果
     */
    @Override
    public int updateDimeBasedisease(DimeBasedisease dimeBasedisease)
    {
        dimeBasedisease.setUpdateBy(SecurityUtils.getUsername());
        dimeBasedisease.setUpdateTime(DateUtils.getNowDate());
        return dimeBasediseaseMapper.updateDimeBasedisease(dimeBasedisease);
    }

    /**
     * 批量删除疾病
     *
     * @param ids 需要删除的疾病主键
     * @return 结果
     */
    @Override
    public int deleteDimeBasediseaseByIds(String[] ids)
    {
        return dimeBasediseaseMapper.deleteDimeBasediseaseByIds(ids);
    }

    /**
     * 删除疾病信息
     *
     * @param id 疾病主键
     * @return 结果
     */
    @Override
    public int deleteDimeBasediseaseById(String id)
    {
        return dimeBasediseaseMapper.deleteDimeBasediseaseById(id);
    }
}
